package com.mvpdemo.mvp;

import android.text.TextUtils;

/**
 * model 就是获取具体的数据 并且进行处理
 */
public class IUserModelImp implements IUserModel {

    private IUserLoginPresenter iUserLoginPresenter;

    public IUserModelImp(IUserLoginPresenter iUserLoginPresenter) {
        this.iUserLoginPresenter = iUserLoginPresenter;
    }

    @Override
    public void onLogin(final String userName, final String pwd, final onLoginListener onLoginListener) {

        new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    Thread.sleep(1000);
                    onLoginListener.loginSuccess();
//                    if (TextUtils.equals(userName, "aaa") && TextUtils.equals(pwd, "123")) {
//                        onLoginListener.loginSuccess();
//                    } else {
//                        onLoginListener.loginFailed();
//                    }
                } catch (InterruptedException e) {
                    e.printStackTrace();
                    onLoginListener.loginFailed();
                }
            }
        }).start();
    }
}
